﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;

namespace PlasmaMes.A_Models
{
    public class RunParam
    {
        #region --- 双绑通知---

        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void OnPropertyChanged(string propertyName)
        {
            var propertyChanged = this.PropertyChanged;
            if (propertyChanged != null)
            {
                propertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }


        #endregion

        // <summary>
        /// 定义一个静态变量来保存类的实例
        /// </summary>
        private static RunParam runParam;

        /// <summary>
        /// 定义一个标识确保线程同步
        /// </summary>
        private static readonly object runParamLock = new object();


        public static RunParam Instance
        {
            get
            {
                if (runParam == null)
                {
                    lock (runParamLock)
                    {
                        runParam = new RunParam();
                    }
                }
                return runParam;
            }

        }

        private RunParam()
        {

        }


        public string RunParamPath = Path.Combine(Directory.GetCurrentDirectory(), "RunParam.json");



        public string GetTokenUrl = "http://t05plug.pmes.aq.pmf.local/GtkPMF.MetalMes.AutoLineInterface/api/token/GetToken";


        public string GetSnUrl = "http://t05plug.pmes.aq.pmf.local/GtkPMF.MetalMes.AutoLineInterface/api/moldingline/getsnbytool";


        public string SnPassUrl = "http://t05plug.pmes.aq.pmf.local/GtkPMF.MetalMes.AutoLineInterface/api/sninfo/SnPassStation";



        /// <summary>
        /// 条码当前机台
        /// </summary>
        public string CurMachine { get; set; }


        /// <summary>
        /// 当前工序
        /// </summary>
        public string CurStage { get; set; }


        /// <summary>
        /// 当前工站
        /// </summary>
        public string CurStation { get; set; }


        /// <summary>
        /// 下一工序
        /// </summary>
        public string NextStage { get; set; }


        /// <summary>
        /// 下一工站
        /// </summary>
        public string NextStation { get; set; }


        /// <summary>
        /// 上游机台IP
        /// </summary>
        public string Keyence_IP { get; set; }


        /// <summary>
        /// 上游机台端口
        /// </summary>
        public int Keyence_Port { get; set; }







        public string Keyence_Down_IP { get; set; }

        public int Keyence_Down_Port { get; set; }




        /// <summary>
        /// 本设备的PLC的IP
        /// </summary>
        public string PLC_IP { get; set; }




        public string Rfid_IP { get; set; }


        public string Rfid_Port { get; set; }


        public bool IsUseGPO1 { get; set; }


        public bool IsUseGPO2 { get; set; }


        public bool IsUseGPO3 { get; set; }


        public bool IsUseGPO4 { get; set; }


        public string Rfid_Addr { get; set; }

        public string Rfid_Length { get; set; }







        public string Url { get; set; }

        public string Token { get; set; }



        public string UserCode { get; set; }

        public string FactoryCode { get; set; }


        public string StageCode { get; set; }

        public string StationCode { get; set; }

        /// <summary>
        /// RFID读出来的码
        /// </summary>
        public string ToolCode { get; set; }





        public string AssetNo { get; set; }

        public string Sn1 { get; set; }

        public string Sn2 { get; set; }

        public int SnCount { get; set; }

        public string IsFinished { get; set; }

        public string DeductMaterials { get; set; }


        public string IsOK { get; set; }



        public string Addr_XJPLC_ProductCompleted { get; set; }

        public string Addr_XJPLC_Feeding { get; set; }

        public string Addr_XJPLC_HadFed {  get; set; }



        public string Addr_KYPLC_SendSignal { get; set; }

        public string Addr_KYPLC_RecvRfid { get; set; }

        public string Addr_KYPLC_Feeding { get; set; }

        public string Addr_KYPLC_HadFed {  get; set;  }


        public string Addr_XJPLC_RecvNeed { get; set; }
        public string Addr__XJPLC_SendReturn { get; set; }

        public string Addr_KYPLC_Down_SendNeed { get; set; }
        public string Addr_KYPLC_Down_RecvReturn { get; set; }

    }
}
